package com.m3;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.File;
import java.util.Date;
import java.util.List;
import org.json.simple.JSONArray;



/**
 * Created by 四毛强 on 2021/7/8.
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Easypoi_ExcelInput {
    @Excel(name = "姓名")
    private String name;
    @Excel(name = "年龄")
    private int age;
    @Excel(name = "操作时间",format="yyyy-MM-dd HH:mm:ss", width = 20.0)
    private Date time;

    public static void main(String[] args) throws Exception{
        ImportParams params = new ImportParams();
        params.setTitleRows(1);
        params.setHeadRows(1);
        String Path = "D:/mDownloads/ChromeDown/E203_批发和零售财务状况.xlsx";
        List<Easypoi_ExcelInput> list = ExcelImportUtil.importExcel(new File(Path),Easypoi_ExcelInput.class, params);
        for (Easypoi_ExcelInput easypoi_excelInput : list) {
            System.out.println("年龄："+easypoi_excelInput.getAge()+"姓名："+easypoi_excelInput.getName()+"操作时间："+easypoi_excelInput.getTime());
            System.out.println();
        }
    }
}
